package com.onluy.frameworkcloud.batis.tools.util;


import java.util.List;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.mapping.ParameterMode;
import org.apache.ibatis.session.Configuration;

public abstract class ParameterUtil
{
    public static boolean isStringOrBasicType(Class<?> clazz)
    {
        return (String.class.isAssignableFrom(clazz)) || (Number.class.isAssignableFrom(clazz)) || (Boolean.class.isAssignableFrom(clazz)) || (Character.class.isAssignableFrom(clazz));
    }

    public static void addParameterMapping(Configuration configuration, List<ParameterMapping> parameterMappings, String operColumnProperty, Class<?> operColumnType)
    {
        ParameterMapping.Builder builder = new ParameterMapping.Builder(configuration, operColumnProperty, operColumnType);
        builder.mode(ParameterMode.IN);
        parameterMappings.add(builder.build());
    }
}